﻿@using Carer.Data
@using Carer.View
@{
    ViewBag.Title = "排班管理";
    Layout = "~/Views/Shared/_Layout.cshtml";

    var crewTypes = ViewBag.CrewTypes as IList<CrewType>;
    if (crewTypes == null)
    {
        crewTypes = new List<CrewType>();
    }

    var categories = ViewBag.Categories as IList<Category>;
    if (categories == null)
    {
        categories = new List<Category>();
    }

    var payments = ViewBag.Payments as IList<Payment>;
    if (payments == null)
    {
        payments = new List<Payment>();
    }
}

<div id="list" class="view">
    <div class="query">
        <ul class="tool">
            <li><button class="add btn btn-default"><span class="add"></span>增 加</button></li>
            <li><button class="delete btn btn-default"><span class="delete"></span> 删 除</button></li>

        </ul>
        <form action="">
            <table>
                <tr>
                    <td class="title">人员姓名</td>
                    <td><input name="CrewName" type="text" class="form-control" /></td>
                    <td class="title">客户姓名</td>
                    <td><input name="CustomerName" type="text" class="form-control" /></td>
                    <td class="title">服务类别</td>
                    <td>
                        <select name="Category" class="form-control">
                            <option value="">所有</option>
                            @foreach (var item in categories)
                            {
                            <option value="@item.Name">@item.Name</option>
                            }
                        </select>
                    </td>
                    <td class="title">分成比例</td>
                    <td>
                        <select name="PaymentId" class="form-control">
                            <option value="">所有</option>
                            @foreach (var item in payments)
                            {
                            <option value="@item.Id">@item.Ratio</option>
                            }
                        </select>
                    </td>
                    <td rowspan="2">
                        <button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button>
                    </td>
                </tr>
                <tr>
                    <td class="title">开始</td>
                    <td><input name="Start" type="text" class="date form-control" /></td>
                    <td class="title">结束</td>
                    <td><input name="End" type="text" class="date form-control" /></td>
                    <td class="title">病区</td>
                    <td><input name="Area" type="text" class="form-control" /></td>
                </tr>
            </table>
        </form>
    </div>

    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th><input class="selall" type="checkbox" /></th>
                    <th>地址</th>
                    <th>客户姓名</th>
                    <th>服务类别</th>
                    <th>服务项目</th>
                    <th>服务人员</th>
                    <th>服务时间</th>
                    <th>结束时间</th>
                    <th>班次</th>
                    <th>收费标准</th>
                    <th>分成比例</th>
                    <th>结算金额</th>
                    <th>调整金额</th>
                    <th class="action">操作</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="lpager" class="jpager"></div>
</div>

<div id="add" class="view edit">
    <form id="AddSchedule" action="AddSchedule" method="post">
        <div class="title"><span>人员信息</span></div>

        <table>
            <tr>
                <td class="title"><font color="red">*</font> 服务时间：</td>
                <td class="content"><input class="Start datetime form-control" name="Start" type="text" /></td>
                <td class="title">结束时间：</td>
                <td class="content"><input class="End form-control" name="End" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务人员：</td>
                <td class="content">
                    <input class="CrewId" name="CrewId" type="hidden" />
                    <div class="input-group">
                        <input class="CrewName form-control" name="CrewName" type="text" readonly="readonly" />
                        <span class="input-group-btn">
                            <button class="browser btn btn-default"><i class="fa fa-lg fa-search"></i></button>
                        </span>
                    </div>
                </td>
                <td class="title"><font color="red">*</font> 班次：</td>
                <td class="content">
                    <select class="Shift pay form-control" name="Shift">
                        <option class="default" value="0">全天</option>
                        <option value="1">白班</option>
                        <option value="2">夜班</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 结算标准：</td>
                <td class="content">
                    <select class="PaymentId form-control" name="PaymentId">
                        @foreach (var item in payments)
                        {
                            <option data-ratio="@item.Ratio" value="@item.Id">@item.Name</option>
                        }
                    </select>
                </td>

                <td class="title"><font color="red">*</font> 分成比例：</td>
                <td class="content"><input class="Ratio pay form-control" name="Ratio" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">调整金额：</td>
                <td class="content"><input class="Adjust form-control" name="Adjust" type="text" /></td>
                <td class="title">节假日：</td>
                <td class="content"><input class="IsHoliday form-control" id="IsHoliday" name="IsHoliday" type="checkbox" /></td>
            </tr>

        </table>

        <div class="title"><span>排班信息</span></div>
        <div class="listAuto">
            <table class="list schedule">
                <thead>
                    <tr>
                        <th>地址</th>
                        <th>客户姓名</th>
                        <th>班次</th>
                        <th>开始时间</th>
                        <th>结束时间</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>

        <div class="title"><span>订单信息</span></div>
        <div class="list">
            <table class="list order">
                <thead>
                    <tr>
                        <th><input class="selall" type="checkbox" /></th>
                        <th>地址</th>
                        <th>客户姓名</th>
                        <th>服务类别</th>
                        <th>服务项目</th>
                        <th>开始时间</th>
                        <th>结束时间</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <div id="errorMsg"></div>
        </div>
        <p class="submit">
            <button class="save btn btn-success" type="submit"><i class="fa fa-save fa-lg"></i> 保 存</button>
            <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
        </p>
    </form>
</div>

<div id="edit" class="view edit">
    <div class="title"><span>排班信息</span></div>
    <form id="editForm" action="EditSchedule" method="post">
        <input class="Id" name="Id" type="hidden" />
        <table>
            <tr>
                <td class="title">订单编号：</td>
                <td class="content"><input class="OrderId form-control" name="OrderId" type="text" readonly="readonly" /></td>
                <td class="title">客户姓名：</td>
                <td class="content"><input class="CustomerName form-control" name="CustomerName" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">服务项目：</td>
                <td class="content"><input class="ServiceName form-control" name="ServiceName" type="text" readonly="readonly" /></td>
                <td class="title">收费标准：</td>
                <td class="content"><input class="ServicePrice pay form-control" name="ServicePrice" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务人员：</td>
                <td class="content">
                    <input class="CrewId" name="CrewId" type="hidden" />
                    <div class="input-group">
                        <input class="CrewName form-control" name="CrewName" type="text" readonly="readonly" />
                        <span class="input-group-btn">
                            <button class="browser btn btn-default"><i class="fa fa-lg fa-search"></i></button>
                        </span>
                    </div>
                </td>
                <td class="title">联系电话：</td>
                <td class="content"><input class="CrewTel form-control" name="CrewTel" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务时间：</td>
                <td class="content"><input class="Start datetime form-control" name="Start" type="text" /></td>
                <td class="title">结束时间：</td>
                <td class="content"><input class="End form-control" name="End" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 班次：</td>
                <td class="content">
                    <select class="Shift pay form-control" name="Shift">
                        <option class="default" value="0">全天</option>
                        <option value="1">白班</option>
                        <option value="2">夜班</option>
                    </select>
                </td>
                <td class="title">节假日：</td>
                <td class="content"><input class="IsHoliday pay form-control" name="IsHoliday" type="checkbox" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 结算标准：</td>
                <td class="content">
                    <select class="PaymentId form-control" name="PaymentId">
                        @foreach (var item in payments)
                        {
                            <option data-ratio="@item.Ratio" value="@item.Id">@item.Name</option>
                        }
                    </select>
                </td>

                <td class="title"><font color="red">*</font> 分成比例：</td>
                <td class="content"><input class="Ratio pay form-control" name="Ratio" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">调整金额：</td>
                <td class="content"><input class="Adjust pay form-control" name="Adjust" type="text" /></td>

                <td class="title"><font color="red">*</font> 结算金额：</td>
                <td class="content"><input class="Pay form-control" name="Pay" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">客户评价：</td>
                <td class="content"><input class="Rate form-control" name="Rate" type="text" /></td>

                <td class="title">备注：</td>
                <td class="content"><input class="Note form-control" name="Note" type="text" /></td>
            </tr>
        </table>
        <p class="submit">
            <button class="save btn btn-success" type="submit"><i class="fa fa-save fa-lg"></i> 保 存</button>
            <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
        </p>
    </form>
</div>

<div id="crew" class="dialog" title="选择人员">
    <div class="query">
        <form action="">
            <ul>
                <li><label>姓名</label><input name="Name" type="text" class="form-control" /></li>
                <li>
                    <label>性质</label>
                    <select name="Type" class="form-control">
                        <option value="">所有</option>
                        @foreach (var item in crewTypes)
                        {
                        <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </li>
                <li>
                    <label>状态</label>
                    <select name="Status" class="form-control">
                        <option value="">所有</option>
                        <option selected="selected">在职</option>
                        <option>离职</option>
                    </select>
                </li>
                <li>
                    <label>技能</label>
                    <select name="Skill" class="form-control">
                        <option value="">所有</option>
                        @foreach (var item in categories)
                        {
                        <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </li>
                <li><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></li>
            </ul>
        </form>
    </div>
    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>身份证</th>
                    <th>性质</th>
                    <th>技能</th>
                    <th>状态</th>
                    <th>电话</th>
                    <th>所属单位</th>
                    <th>服务单位</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="wpager" class="jpager"></div>
</div>
@section Scripts {
    @Scripts.Render("~/Content/jQuery/date.format.js")
    @Scripts.Render("~/Content/Common/util.js?v=" + MvcApplication.TimeStamp)
    @Scripts.Render("~/Content/Business/schedule.js?v=" + MvcApplication.TimeStamp)
}